package com.allwees.sender.sms;

import com.allwees.core.common.exception.BaseException;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * SMS发送结果
 *
 * @author yangylsky
 * @since 2020-01-02
 *
 */
@Data
@Accessors(chain = true)
public class SendResult {
	private String code;

	private boolean success;

	private String msg;

	private BaseException exception;

	private SendResult() {
	}

	static SendResult success(String code) {
		return new SendResult().setSuccess(true).setCode(code).setMsg(code);
	}

	static SendResult failed(String code, String msg, BaseException exception) {
		return new SendResult().setSuccess(false).setCode(code).setMsg(msg).setException(exception);
	}
}
